﻿<%@ Page Title="Xtablish CRM / Loyalty" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
    CodeBehind="Loyalty.aspx.cs" Inherits="Web.Loyalty.Loyalty" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<asp:Content ID="Content1" ContentPlaceHolderID="headContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Con1" runat="server">
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">
            function OnClientClose(oWnd, args) { }
            function OnBlur(sender, args) {
                if (sender.get_value() == "") {
                    sender.set_value("0");
                }
            }
            function setSelectedIndex(combo) {
                combo.trackChanges();
                combo.get_items().getItem(0).select();
                combo.updateClientState();
                combo.commitChanges();
            }

            function ClearClick() {
                document.getElementById('<%= txtLoyaltyName.ClientID %>').value = "";
                $find("<%= rntxtPointToAward.ClientID %>").set_value("0");
                $find("<%= rntxtExchangeRate.ClientID %>").set_value("0");
                var atcombo = $find("<%= ddlAssignedTo.ClientID %>");
                setSelectedIndex(atcombo);
            }
        </script>
    </telerik:RadCodeBlock>
    <div class="register">
        <div class="container-fluid">
            <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
                <div class="row">
                    <div class="panel panel-default">
                        <div class="panel-heading" role="tab" id="headingOne">
                            <h4 class="panel-title">
                                <a data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="true" aria-controls="collapseOne">Search <i class="glyphicon glyphicon-circle-arrow-down" style="display: none;"></i><i class="glyphicon glyphicon-circle-arrow-up"></i>
                                </a>
                            </h4>
                        </div>
                        <div id="collapseOne" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingOne">
                            <div class="panel-body">
                                <div class="firstrow">
                                    <div class="edit-form">
                                        <div class="control-group">
                                            <div class="col-md-4 distance-control">
                                                <div class="col-md-4">
                                                    <label class="control-label">Name </label>
                                                </div>
                                                <div class="col-md-8">
                                                    <div class="controls">
                                                        <asp:TextBox ID="txtLoyaltyName" runat="server" class="form-control" onkeypress="isPressEnter(event)" />
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="col-md-4 distance-control">
                                                <div class="col-md-4">
                                                    <label class="control-label">Points to award </label>
                                                </div>
                                                <div class="col-md-8">
                                                    <div class="controls">
                                                        <telerik:RadNumericTextBox ShowSpinButtons="True" Type="Number" ID="rntxtPointToAward" runat="server"
                                                            Width="50%" CssClass="RadNumbericText" Value="0">
                                                            <ClientEvents OnBlur="OnBlur" />
                                                        </telerik:RadNumericTextBox>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="col-md-4 distance-control">
                                                <div class="col-md-4">
                                                    <label class="control-label">Exchange Rate </label>
                                                </div>
                                                <div class="col-md-8">
                                                    <div class="controls">
                                                        <telerik:RadNumericTextBox ShowSpinButtons="True" Type="Number" ID="rntxtExchangeRate" runat="server"
                                                            Width="50%" CssClass="RadNumbericText" Value="0">
                                                            <ClientEvents OnBlur="OnBlur" />
                                                        </telerik:RadNumericTextBox>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="clearfix"></div>
                                        </div>
                                        <div class="control-group">
                                            <div class="col-md-4 distance-control">
                                                <div class="col-md-4">
                                                    <label class="control-label">Date Created From </label>
                                                </div>
                                                <div class="col-md-8">
                                                    <div class="controls">
                                                        <telerik:RadDatePicker ID="dpDateCreatedFrom" runat="server" Width="50%">
                                                            <DateInput ReadOnly="true" ID="RadDateInput1" runat="server">
                                                            </DateInput>
                                                            <Calendar ReadOnly="true" ID="Calendar1" runat="server" UseColumnHeadersAsSelectors="False"
                                                                UseRowHeadersAsSelectors="False" ViewSelectorText="x">
                                                                <SpecialDays>
                                                                    <telerik:RadCalendarDay Repeatable="Today" ItemStyle-CssClass="rcToday">
                                                                    </telerik:RadCalendarDay>
                                                                </SpecialDays>
                                                            </Calendar>
                                                        </telerik:RadDatePicker>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="col-md-4 distance-control">
                                                <div class="col-md-4">
                                                    <label class="control-label">Date Created To </label>
                                                </div>
                                                <div class="col-md-8">
                                                    <div class="controls">
                                                        <telerik:RadDatePicker ID="dpDateCreatedTo" runat="server" Width="50%">
                                                            <DateInput ReadOnly="true" ID="DateInput2" runat="server">
                                                            </DateInput>
                                                            <Calendar ReadOnly="true" ID="Calendar2" runat="server" UseColumnHeadersAsSelectors="False"
                                                                UseRowHeadersAsSelectors="False" ViewSelectorText="x">
                                                                <SpecialDays>
                                                                    <telerik:RadCalendarDay Repeatable="Today" ItemStyle-CssClass="rcToday">
                                                                    </telerik:RadCalendarDay>
                                                                </SpecialDays>
                                                            </Calendar>
                                                        </telerik:RadDatePicker>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="col-md-4 distance-control" id="divAssignedTo" runat="server">
                                                <div class="col-md-4">
                                                    <label class="control-label">Assign To </label>
                                                </div>
                                                <div class="col-md-8">
                                                    <div class="controls">
                                                        <telerik:RadComboBox ID="ddlAssignedTo" runat="server" class="form-control"
                                                            Width="80%" Filter="StartsWith" MaxHeight="700px" />
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="clearfix"></div>
                                        </div>
                                    </div>
                                </div>
                                <div class="popup-btn">
                                    <div class="col-md-12 btn-edit">
                                        <button id="btnSearch" type="button" class="btn btn-defaul" runat="server" onserverclick="btnSearch_ServerClick">
                                            <img src="../Images/search.png" style="width: 20px; height: 20px" />
                                            Search
                                        </button>
                                        <button class="btn btn-defaul" type="button" onclick="ClearClick();return false;">
                                            <img src="../Images/clear.png" style="width: 20px; height: 20px" />
                                            Clear
                                        </button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="edit-form highlight">
                        <div class="control-group">
                            <h4>Loyalty</h4>
                        </div>
                        <div class="col-md-12 combobox-email" id="divAddLoyalty" runat="server">
                            <div class="col-md-8 btn-edit">
                                <button id="btnAddLoyalty" type="button" class="btn btn-defaul" runat="server" onserverclick="btnAddLoyalty_ServerClick">
                                    <img src="../Images/add.png" style="width: 16px; height: 16px" />
                                    Add Loyalty
                                    
                                </button>
                            </div>
                        </div>
                        <div class="clearfix"></div>
                        <div style="width: 100%">
                            <telerik:RadGrid ID="RadGrid1" ShowStatusBar="True" runat="server" AllowPaging="True" AllowSorting="True" AllowMultiRowSelection="True"
                                AllowFilteringByColumn="false" AutoGenerateColumns="False" GridLines="None" Width="100%" OnNeedDataSource="RadGrid1_NeedDataSource"
                                Font-Size="12px" EnableLinqExpressions="false" OnItemCreated="RadGrid1_ItemCreated"
                                OnPreRender="RadGrid1_PreRender" OnItemCommand="RadGrid1_ItemCommand">
                                <ClientSettings EnableRowHoverStyle="true" EnablePostBackOnRowClick="false">
                                    <Selecting AllowRowSelect="false" />
                                </ClientSettings>
                                <MasterTableView PageSize="10" NoDetailRecordsText="No records" NoMasterRecordsText="No records" ShowHeader="true" DataKeyNames="ID" TableLayout="Fixed" >
                                    <Columns>
                                        <telerik:GridTemplateColumn HeaderText="Seq" UniqueName="TemplateColumn1">
                                            <ItemTemplate>
                                                <asp:Label ID="lblSeq" runat="server" Text="<%# RadGrid1.CurrentPageIndex*RadGrid1.MasterTableView.PageSize + RadGrid1.Items.Count+1 %>">
                                                </asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle Font-Bold="true" HorizontalAlign="Center" Width="5%" />
                                            <ItemStyle HorizontalAlign="Center" Width="5%" />
                                        </telerik:GridTemplateColumn>
                                        <telerik:GridBoundColumn DataField="NAME" HeaderText="Name" UniqueName="NAME" SortExpression="NAME">
                                            <HeaderStyle Font-Bold="true" HorizontalAlign="center" Width="20%" Font-Size="12px" />
                                             <ItemStyle Wrap="false" HorizontalAlign="left" Width="20%" Font-Size="12px" />
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="DESCRIPTION" HeaderText="Description" UniqueName="DESCRIPTION" SortExpression="DESCRIPTION">
                                            <HeaderStyle Font-Bold="true" HorizontalAlign="center" Width="25%" Font-Size="12px" />
                                             <ItemStyle Wrap="false" HorizontalAlign="left" Width="25%" Font-Size="12px" />
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="POINTS_TO_AWARD" HeaderText="Points to award" UniqueName="POINTS_TO_AWARD" SortExpression="POINTS_TO_AWARD" DataFormatString="{0:N2}">
                                            <HeaderStyle Font-Bold="true" HorizontalAlign="center" Width="10%" Font-Size="12px" />
                                            <ItemStyle HorizontalAlign="center" Width="10%" Font-Size="12px" />
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="EXCHANGE_RATE" HeaderText="Exchange Rate" UniqueName="EXCHANGE_RATE" SortExpression="EXCHANGE_RATE" DataFormatString="{0:N2}">
                                            <HeaderStyle Font-Bold="true" HorizontalAlign="center" Width="10%" Font-Size="12px" />
                                            <ItemStyle HorizontalAlign="center" Width="10%" Font-Size="12px" />
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="DATE_CREATED" HeaderText="Date Created" UniqueName="DATE_CREATED" SortExpression="DATE_CREATED" DataFormatString="{0:d}" DataType="System.DateTime">
                                            <HeaderStyle Font-Bold="true" HorizontalAlign="center" Width="10%" Font-Size="12px" />
                                            <ItemStyle HorizontalAlign="center" Width="10%" Font-Size="12px" />
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="ASSIGN_TO_NAME" HeaderText="Assign To" UniqueName="ASSIGN_TO_NAME" SortExpression="ASSIGN_TO_NAME">
                                            <HeaderStyle Font-Bold="true" HorizontalAlign="center" Width="10%" Font-Size="12px" />
                                             <ItemStyle Wrap="false" HorizontalAlign="left" Width="10%" Font-Size="12px" />
                                        </telerik:GridBoundColumn>
                                        <telerik:GridTemplateColumn AllowFiltering="false" HeaderText="Tools" UniqueName="TOOLS">
                                            <HeaderStyle Font-Bold="true" HorizontalAlign="center" Width="10%" />
                                            <ItemStyle HorizontalAlign="center" Width="10%" />
                                            <ItemTemplate>
                                                <asp:LinkButton ID="lbtnEdit" runat="server" CommandName="Edit" ToolTip="Edit">
                                                    <image src="../Images/edit.png" style="width: 16px; height: 16px"/>
                                                </asp:LinkButton>
                                                &nbsp
                                                <asp:LinkButton ID="lbtnDelete" runat="server" ToolTip="Delete" CommandName="Delete" OnClientClick="return radConfirmDelete(this, 'Are you sure you want to delete this loyalty ?');">
                                                    <image src="../Images/delete.png" style="width: 16px; height: 16px"/>
                                                </asp:LinkButton>
                                            </ItemTemplate>
                                        </telerik:GridTemplateColumn>
                                    </Columns>
                                    <PagerStyle PageSizes="5,10,20,50" PagerTextFormat="{4}<strong>{5}</strong> items matching your search criteria"
                                        PageSizeLabelText="Items per page:" AlwaysVisible="true" />
                                </MasterTableView>
                                <PagerStyle Mode="NumericPages"></PagerStyle>
                            </telerik:RadGrid>
                        </div>
                    </div>
                    <div class="clearfix"></div>
                </div>
            </div>
        </div>
    </div>
</asp:Content>
